package caches;
import java.util.concurrent.atomic.AtomicReference;


public class ImmutableCache<K, V> {
	private final AtomicReference<K> key = new AtomicReference<>();
	private final AtomicReference<V> value = new AtomicReference<>();

	public ImmutableCache() {}
	
	public ImmutableCache(K k, V v) {
		key.set(k);
		value.set(v);
	}

	public V get(K key) {
		if (this.key.get() != null && this.key.get().equals(key))
			return value.get();
		else
			return null;
	}
}
